package net.chathu.airgw.model 
{
	/**
	 * ...
	 * @author ze
	 */
	public class DisturbState 
	{
		private static var _states:Array = new Array();
		public static const DO_NOT_DISTURB:DisturbState = new DisturbState(0, "Ne zavarj!");
		public static const ANYONE_MAY_DISTURB:DisturbState = new DisturbState(1, "Bárki zavarhat");
		public static const FRIENDS_MAY_DISTURB:DisturbState = new DisturbState(2, "Barátok zavarhatnak");
		public static const REGISTRED_USERS_MAY_DISTURB:DisturbState = new DisturbState(3, "Regisztráltak zavarhatnak");
		
		private var _code:int;
		private var _description:String;
		
		
		public function DisturbState(code:int, description:String) 
		{
			_code = code;
			_description = description;
			_states.push(this);
		}
		
		public function get code():int {
			return _code;
		}
		
		public function get description():String {
			return _description;
		}
		
		public static function getStateByCode(code:int):DisturbState {
			for (var i:int = 0; i < _states.length; i++) {
				var state:DisturbState = _states[i] as DisturbState;
				if (state.code == code) {
					return state;
				}
			}
			return null;
		}
		
	}

}